/**
 * ios系统分享
 */
var SystemShareUtil = {};

/**
 * 系统分享text
 * @param text
 * @public
 */
SystemShareUtil.shareText = function (text, title) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'SystemShareUtil',
            'shareText:',
            text
        );
    }
    else if (cc.sys.os == cc.sys.OS_ANDROID) {
        // cc.log("text,title" + text + title);
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/SystemShareUtil',
            'shareText', '(Ljava/lang/String;Ljava/lang/String;)V',
            title, text
        );
    }
};
/**
 * 系统分享url
 * @param url
 * @public
 */
SystemShareUtil.shareUrl = function (url, title) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'SystemShareUtil',
            'shareUrl:',
            url
        );
    }
    else if (cc.sys.os == cc.sys.OS_ANDROID) {
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/SystemShareUtil',
            'shareText', '(Ljava/lang/String;Ljava/lang/String;)V',
            title, url
        );
    }
};
/**
 * 系统分享image
 * @param path
 * @public
 */
SystemShareUtil.sharePic = function (path, title) {
    if (cc.sys.os == cc.sys.OS_IOS) {
        jsb.reflection.callStaticMethod(
            'SystemShareUtil',
            'sharePic:',
            path
        );
    }
    else if (cc.sys.os == cc.sys.OS_ANDROID) {
        title = "分享";
        jsb.reflection.callStaticMethod(
            packageUri + '/utils/SystemShareUtil',
            'sharePic', '(Ljava/lang/String;Ljava/lang/String;)V',
            title, path
        );
    }
};
/**
 * 系统分享截图
 * @param node
 * @public
 */
SystemShareUtil.shareImage = function (node) {
    captureNode(node, function (path) {
        SystemShareUtil.sharePic(path);
    });
};

/**
 * 系统分享回调
 * @param code
 * @public
 */
SystemShareUtil.shareResq = function (code) {
    // cc.log("codecodecode="+code);
    // eventManager.dispatchEvent(EventKey.ReceiveSystemShare, code);
};

